package com.proyecto.track.bo;

import java.util.Date;

import javax.persistence.*;

@Entity
public class ProjectUser {
	private Long id;
	private boolean active ;
	private Project project;
	private UserPerson userPerson;
	private Date startDate;
	
	public ProjectUser(){
		
	}
	
	public ProjectUser(boolean active, Project project, UserPerson userPerson){
	    java.util.Date today = new java.util.Date();
		
		this.active = active;
		this.project = project;
		this.userPerson = userPerson;
		this.startDate = new java.sql.Timestamp(today.getTime());
	}

	public ProjectUser(boolean active, Date startDate){
		this.active = active;
		this.startDate = startDate;
	}

	
	@Id
	@GeneratedValue
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	
	public boolean isActive() {
		return active;
	}
	public void setActive(boolean active) {
		this.active = active;
	}
	
	@ManyToOne(fetch = FetchType.LAZY)
	public Project getProject() {
		return project;
	}
	public void setProject(Project project) {
		this.project = project;
	}
	
	public Date getStartDate() {
		return startDate;
	}
	public void setStartDate(Date startDate) {
		this.startDate = startDate;
	}
	
	@ManyToOne(fetch = FetchType.LAZY)
	public UserPerson getUserPerson() {
		return userPerson;
	}
	public void setUserPerson(UserPerson userPerson) {
		this.userPerson = userPerson;
	}
}
